package com.qst.controller;

import com.qst.Service.RoomService;
import com.qst.pojo.Room;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @packageName:com.qst.controller
 * @className:RoomController
 * @Description:
 * @author:zhangyu
 * @date 2021/6/18 13:29
 **/

@Controller
public class RoomController {

    @Resource
    private RoomService roomService;

    @RequestMapping(value = "/room")
    public ModelAndView roomList(){
        List<Room> roomList = roomService.roomList();
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("roomList", roomList);
        modelAndView.setViewName("min");
        return modelAndView;
    }
    @RequestMapping(value = "/order")
    public ModelAndView order1(int id){
        List<Room> room = roomService.query(id);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("roomorder", room);
        modelAndView.setViewName("order");
        return modelAndView;

    }
}
